<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class OperationalLogs extends Model
{
    use HasFactory;
    use SoftDeletes;

    static $unguarded = true;

    protected $table = 'operational_logs';

    /**
     * 添加操作日志数据
     *
     * @param $parameter
     * @return void
     */
    static public function AddOperationalLogs($parameter)
    {
        $data = [
            'ip'=>ip2long(GetIPAddress()),
            'version'=>'WEB1.0',#todo:待定
        ];
        $create = array_merge($parameter,$data);
        self::query()->create($create);
    }

    static public $operateItem = [
        'login'=>'用户-用户登录',
        'logout'=>'用户-退出登录',
        'account_manage'=>'管理员账号管理',
        'banner_manage'=>'Banner管理',
        'notice_manage'=>'公告管理',
        'organization_manage'=>'组织管理',
        'feedback_manage'=>'意见反馈管理',
        'posts_manage'=>'帖子管理',
        'activity_manage'=>'活动管理',
        'appointment_manage'=>'预约管理',
        'customer_manage'=>'客服管理',
        'users_manage'=>'用户管理',

    ];

    static public $operate = [
        'account_delete'=>'删除管理员账号',
        'banner_delete'=>'删除Banner数据',
        'banner_status_change'=>'修改Banner状态',
        'notice_delete'=>'删除公告数据',
        'notice_status_change'=>'修改公告状态',
        'organization_delete'=>'删除组织数据',
        'organization_status_change'=>'修改组织状态',
        'feedback_delete'=>'删除意见反馈',
        'posts_delete'=>'删除帖子信息',
        'posts_status_change'=>'修改帖子状态',
        'postsComment_delete'=>'删除帖子评论',
        'postsComment_status_change'=>'帖子评论审核状态',
        'activity_add'=>'创建活动',
        'activity_edit'=>'修改活动信息',
        'activity_delete'=>'删除活动',
        'school_gate_add'=>'添加校门',
        'school_gate_edit'=>'修改活动',
        'school_gate_delete'=>'删除校门',
        'school_gate_status_change'=>'修改校门状态',
        'appointment_status_change'=>'修改预约状态',
        'appointment_notice_setting'=>'设置预约须知',
        'customer_telephone_setting'=>'设置客服电话',
        'change_status'=>'审核用户',
    ];
}

